package com.venta.autopartes.utils;

import java.util.List;

public class FormatUtility {
	
	public static String renameFileName(String fullFileName, String newFileName){
		fullFileName=fullFileName.replaceAll("[A-Za-z0-9\\-\\_]*\\.", newFileName+".");
		
		return fullFileName.toString();
	}
	
	public static String renameExtensionFileName(String fullFileName, String newExtesionName){
		
		fullFileName=fullFileName.replaceAll("\\.tmp$", "."+newExtesionName);
		
		return fullFileName;
	}
	
	public static String renameFullFileName(String fullFileName, String newFileName,String newExtesionName){
		fullFileName=renameFileName(fullFileName, newFileName);
		fullFileName=renameExtensionFileName(fullFileName, newExtesionName);
		
		return fullFileName.toString();
	}
	
	
	public static List<String> renameFullFileNameList(List<String> fullFileNameList, String newBaseFileName,String newExtesionName){
		for(int i=0; i<fullFileNameList.size();i++){
			String fullFileName=fullFileNameList.get(i);
			fullFileName=renameFileName(fullFileName, newBaseFileName+"_0000"+i);
			fullFileName=renameExtensionFileName(fullFileName, newExtesionName);
		}
		
		
		
		return fullFileNameList;
	}
	
	public static String changeToUpperCase(String originalString){
		return originalString.toUpperCase();
	}
	
	public static void main(String[] args){
		System.out.println(renameFullFileName("upload_17c23339_13ba1471775__8000_00000001.tmp","text","jpg"));
	}

}
